<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="v2/layout">
  <head>
    <title>欢迎进入管理系统</title>
    <script type="text/javascript" th:inline="javascript">
    	var switchUser = function(id){
    		$.ajaxData({url:'list-switchUser',type:"post",data:{id:id},success:function(ret){
    			$.jjalert({text:"切换成功", yes:function(){
    				location.reload();	
    			}});
    			
    		}})
    	}
    
    	$(function(){
    		setMenu("机构管理", true);
    		
    		$("#listPage").page({url:"list-list",data:{parentId:0}, success:function(ret){
      			$.each(ret.obj.content, function(i,v){
        			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm");
        		});
      			$.setData({content:ret.obj.content});
      		}});
    		
    		
    	});
    </script>
    <style>
    </style>
  </head>
  <body>
    <div layout:fragment="content">
    	<!-- <div class="c_tab">
   			<ul class="c_tab-list" id="state">
   				<li data-wyx-class="{parentId==''?'active':''}" onclick="$('#listPage').pageReload({parentId:'0'});$.setData({parentId:''});">全部</li>
   				<li data-wyx-class="{parentId=='0'?'active':''}" onclick="$('#listPage').pageReload({parentId:''});$.setData({parentId:'0'});">主账号</li>
   			</ul>
    	</div>
    	<div class="search">
    		<div class="search-item">
    			<div class="search-control">
    				<input class="search-text" id="name" placeholder="机构名称" type="text">
    				<input class="search-text" id="number" placeholder="编号" type="text">
    			</div>
    			<div class="search-btn">
    				<span class="search-button" onclick="$('#listPage').pageReload({name:$('#name').val(),id:$('#number').val()});">查询</span>
    			</div>
    		</div>
    	</div> -->
    	
		<div class="info info-full">
			<div class="table_list">
               <div class="table-overflow">
                   <table class="table">
                       <thead>
                           <tr>
                               <th>机构名称</th>
                               <th>编号</th>
                               <th>创建时间</th>
                               <th>操作</th>
                           </tr>
                       </thead>
                       <tbody>
						<tr data-wyx-for="{data:content}">
						<td data-wyx-text="{data.name}"></td>
						<td data-wyx-text="{data.number}"></td>
						<td data-wyx-text="{data.createdAt}"></td>
						<td>
							<div class="tab-btn-list">
								<a class="tab-btn-item" data-wyx-href="javascript:switchUser({data.id})">切换该账号</a>
							</div>
						</td>
                       </tr>
                     </tbody>
                 </table>
                 <div id="listPage"></div>
             </div>
          </div>
    	</div>
    	
    </div>
  </body>
</html>